﻿<%@ Page Language="C#" MasterPageFile="~/MasterPages/JAFagus.Master" AutoEventWireup="true" CodeBehind="TinTuc.aspx.cs" Inherits="Indeco.G24.Website.News.Admin.TinTuc" %>
<%@ Register Src="~/UserControls/MenuNewsAdmin.ascx" TagName="Menu" TagPrefix="G24" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolderMain" runat="server">    
<script type="text/javascript">
        function OnUpdateClick() {
            uploader.UploadFile();
    }
 function AddNew(key,index)
{    
    grid.AddNewRow();
}
function Edit(key,index)
{    
    grid.StartEditRow(index);
}
    function Delete(id, visibleIndex)
    {
        if(confirm('Bạn muốn xóa bản ghi này ?'))         
           {
             grid.DeleteRow(visibleIndex);                     
           }
    }
    </script>
    
<asp:Panel ID="grid" runat="server" Height="100%" Width="100%" >  
<div style="width:919px;padding:2,2,2,2;">
<div style="float:left;width:190px;margin-left:7px;" >
 <G24:Menu ID="menu1" runat="server" />     
</div>
<div style="float:left;width:715px;padding-left:2px;">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr>
        <td class="tdBCTopLeft"></td>
        <td class="tdBCTopCenter"></td>
        <td class="tdBCTopRight"></td>
        </tr>
        <tr>
        <td class="tdBCMiddleLeft"><div class="tdBCMiddleLeft" style="visibility:hidden"></div></td>
        <td class="tdBCMiddleCenter">
	        <div class="divBCMiddleCenterHeader" >
                <div class="divBCMiddleCenterHeaderTitle" >                 
                    <span class="span-blockTitle"><asp:HyperLink ID="HyperLink2" ForeColor="#FFFFFF" CssClass="span-blockTitleTxt" runat="server">Quản lý tin tức</asp:HyperLink></span>
                </div>
            </div>
            <div class="divBCMiddleCenterContent" style="">
               <dxwgv:ASPxGridView ID="ASPxGridView3" ClientInstanceName="grid" runat="server"
          DataSourceID="TinTucDataSource" KeyFieldName="IDTinTuc" 
          AutoGenerateColumns="False" Width="100%"  CssFilePath="~/App_Themes/BlackGlass/{0}/styles.css" 
          CssPostfix="BlackGlass" OnRowInserting="ASPxGridView3_RowInserting"
           OnRowUpdating="ASPxGridView3_RowUpdating" 
           OnStartRowEditing="ASPxGridView3_StartRowEditing" OnRowDeleted="ASPxGridView3_RowDeleted" 
            OnRowDeleting="ASPxGridView3_RowDeleting"
            OnRowInserted="ASPxGridView3_RowInserted" >
          <Columns>
         <dxwgv:GridViewDataColumn Name="Delete" VisibleIndex="4">
            <EditFormSettings VisibleIndex="1" CaptionLocation="None" Visible="False" ColumnSpan="2" />
            <DataItemTemplate>
            <a ID="A2" style="color:#3E6B96;text-decoration:none;" onclick="Edit('<%# Container.KeyValue.ToString()%>', '<%# Container.VisibleIndex.ToString()%>')" href="#">Edit</a>
            <a ID="A1" style="color:#3E6B96;text-decoration:none;" onclick="AddNew('<%# Container.KeyValue.ToString()%>', '<%# Container.VisibleIndex.ToString()%>')" href="#">New</a>
            <a ID="DeleteButton" style="color:#3E6B96;text-decoration:none;" onclick="Delete('<%# Container.KeyValue.ToString()%>', '<%# Container.VisibleIndex.ToString()%>')" href="#">Delete</a>            
            </DataItemTemplate>
            </dxwgv:GridViewDataColumn>
             <dxwgv:GridViewDataTextColumn FieldName="IDTinTucDanhMuc" Visible="False" VisibleIndex="1" Name="Danh Muc Cha">
                <EditFormSettings VisibleIndex="1" Visible="True" CaptionLocation="None" ColumnSpan="2" />
                <EditItemTemplate>  
                 <div id="divTen" align="left"> 
                 <div style="float:left;width:80px;">
                 Danh Mục Cha
                 </div>
                 <div style="float:left;">
                 <dxe:ASPxComboBox ID="ASPxComboBox1" runat="server" Value='<%# Bind("IDTinTucDanhMuc")%>' 
                     TextField="Ten" ValueField="IDTinTucDanhMuc" DataSourceID="Custommize" ValueType="System.Guid"  DropDownStyle="DropDown">                     
                    </dxe:ASPxComboBox>
                 </div>                            
                    </div>         
                   <data:TinTucDanhMucDataSource ID="Custommize" SelectMethod="GetPaged" runat="server" >                               
                   </data:TinTucDanhMucDataSource> 
                </EditItemTemplate>                
             </dxwgv:GridViewDataTextColumn>
              <dxwgv:GridViewDataTextColumn FieldName="TieuDe" VisibleIndex="1" Name="Tieu De">
                <EditFormSettings VisibleIndex="0" CaptionLocation="None" ColumnSpan="2"/>
                 <EditItemTemplate>
                     <div id="divTen" align="left">
                      <div style="float:left;width:80px;">
                            Tiêu Đề
                         </div>
                         <div style="float:left;">
                           <dxe:ASPxMemo ID="TieuDe"  runat="server" Height="71px" Width="350px" Text='<%# Bind("TieuDe") %>'>
                            </dxe:ASPxMemo>
                         </div>   
                   
                    </div>
                </EditItemTemplate>
             </dxwgv:GridViewDataTextColumn>
              <dxwgv:GridViewDataTextColumn FieldName="MoTa" Visible="False" VisibleIndex="2" Name="Mo ta">
                <EditFormSettings VisibleIndex="2" CaptionLocation="None" Visible="True" ColumnSpan="2" />
                <EditItemTemplate>
                <div id="divTen" align="left">
                      <div style="float:left;width:80px;">
                     Mô tả
                     </div>
                     <div style="float:left;">
                    <dxe:ASPxMemo ID="MoTa" runat="server" Text='<%# Bind("MoTa") %>' Height="71px" Width="350px">
                    </dxe:ASPxMemo>
                     </div>                    
                </div>                    
                </EditItemTemplate>
             </dxwgv:GridViewDataTextColumn>
              <dxwgv:GridViewDataTextColumn FieldName="NoiDung" Visible="False"  VisibleIndex="3" Name="Noi Dung">               
              <EditFormSettings VisibleIndex="2" CaptionLocation="None" Visible="True" ColumnSpan="2" />
              <EditItemTemplate>
              <div id="divTen" align="left">
                <div style="float:left;width:80px;">
                 Nội Dung
                 </div>
                 <div style="float:left;">
                <dxhe:ASPxHtmlEditor ID="NoiDung" runat="server" Html='<%# Bind("NoiDung") %>' Width="350px">                     
                    <SettingsImageUpload UploadImageFolder="~/Data/Images/News" 
                     ValidationSettings-AllowedContentTypes="image/jpeg,image/pjpeg,image/gif,image/png,image/x-png" 
                     ValidationSettings-MaxFileSize="4000000"/>                                                            
                 </dxhe:ASPxHtmlEditor>   
                 </div>               
                 </div>
              </EditItemTemplate>
             </dxwgv:GridViewDataTextColumn>
             <dxwgv:GridViewDataTextColumn FieldName="HinhMinhHoa" VisibleIndex="2" Visible="False" Name="Hinh Minh Hoa">
              <EditFormSettings VisibleIndex="2" CaptionLocation="None" Visible="True" ColumnSpan="2" /> 
               <EditItemTemplate>
               <div id="divTen" align="left">
                <div style="float:left;width:80px;">
                Hình Minh Họa
                 </div>
                 <div style="float:left;">                    
                    <dxe:ASPxImage ID="HinhMinhHoa" ClientInstanceName="imgHinhMinhHoa" runat="server" ImageUrl='<%#Bind("HinhMinhHoa") %>'>
                    <EmptyImage Url="../../App_Themes/Default/Images/NoImages.jpg" />      
                    </dxe:ASPxImage>
                     <dxuc:ASPxUploadControl runat="server" ClientInstanceName="uploader" Size="35" ID="ASPxUploadControl1" OnFileUploadComplete="ASPxUploadControl1_FileUploadComplete">
                    <ClientSideEvents FileUploadComplete="function(s, e) { if (e.isValid) alert('Complete Upload !'); }" />
                    <ValidationSettings AllowedContentTypes="image/jpeg,image/pjpeg,image/gif,image/bmp" MaxFileSize="4000000">
                    </ValidationSettings>                                    
                    </dxuc:ASPxUploadControl>
                    <input type="button" id="Up" name="UpLoad" value="UpLoad" onclick="OnUpdateClick()"/>
                </div>
                 </div>  
               </EditItemTemplate>
             </dxwgv:GridViewDataTextColumn>
              <dxwgv:GridViewDataTextColumn FieldName="MoTaHinh" VisibleIndex="2" Visible="False" Name="Mo Ta Hinh">               
             <EditFormSettings VisibleIndex="2" CaptionLocation="None" Visible="True" ColumnSpan="2" />
             <EditItemTemplate>
             <div id="divTen" align="left">
              <div style="float:left;width:80px;">
                Mô Tả Hình
                 </div>
                 <div style="float:left;">
                   <dxe:ASPxMemo ID="MoTaHinh" runat="server" Width="300px" Text='<%# Bind("MoTaHinh") %>'>
                     </dxe:ASPxMemo>
                 </div>   
              </div>
             </EditItemTemplate>
             </dxwgv:GridViewDataTextColumn>
              <dxwgv:GridViewDataColumn FieldName="SoLanXem"  VisibleIndex="2" Visible="False" Name="So Lan Xem">               
             </dxwgv:GridViewDataColumn>
             <dxwgv:GridViewDataTextColumn FieldName="NguonTin" VisibleIndex="2" Visible="False" Name="Nguon Tin">
                <EditFormSettings VisibleIndex="4" CaptionLocation="None" ColumnSpan="2" Visible="True"  />
                <EditItemTemplate>
                    <div id="divTen" align="left"> 
                      <div style="float:left;width:80px;">
                    Nguồn Tin
                     </div>
                     <div style="float:left;">
                      <dxe:ASPxTextBox ID="NguonTin" runat="server" Width="170px" Text='<%# Bind("NguonTin") %>'>
                        </dxe:ASPxTextBox>
                     </div> 
                    </div>
                </EditItemTemplate>
             </dxwgv:GridViewDataTextColumn>
              <dxwgv:GridViewDataTextColumn FieldName="NhaCungCap" VisibleIndex="2" Name="Nha Cung Cap"> 
              <EditFormSettings Visible="False" />               
             </dxwgv:GridViewDataTextColumn>
              <dxwgv:GridViewDataCheckColumn FieldName="TrangThai"  Visible="False" VisibleIndex="5" Name="Trang Thai">
                <EditFormSettings VisibleIndex="5" Visible="True" CaptionLocation="None" ColumnSpan="2"  />
                <EditItemTemplate>
                 <div id="divTen" align="left">
                  <div style="float:left;width:80px;">
                    Trạng Thái
                 </div>
                 <div style="float:left;">
                   <dxe:ASPxCheckBox ID="TrangThai" runat="server" Width="100px" Value='<%# Bind("TrangThai") %>'>
                  </dxe:ASPxCheckBox>
                 </div>  
                 </div>
                </EditItemTemplate>
             </dxwgv:GridViewDataCheckColumn>
              <dxwgv:GridViewDataDateColumn FieldName="ThoiDiemChinhSua" Visible="False" VisibleIndex="6" Name="Thoi Diem Chinh Sua">                
              <EditFormSettings Visible="False" />     
             </dxwgv:GridViewDataDateColumn>
              <dxwgv:GridViewDataDateColumn FieldName="ThoiDiemCapNhat" VisibleIndex="3" Name="Thoi Diem Cap Nhat">                
             <EditFormSettings Visible="False" />            
             </dxwgv:GridViewDataDateColumn> 
             <dxwgv:GridViewDataColumn FieldName="IDTinTucDanhMucSource.Ten" Caption="Ten Danh Muc" VisibleIndex="0" GroupIndex="0" SortIndex="0" SortOrder="Ascending">             
              <EditFormSettings VisibleIndex="7" Caption="Ten Danh Muc" Visible="False"  ColumnSpan="2" />
              <Settings  GroupInterval="DisplayText"/>             
             </dxwgv:GridViewDataColumn>
     </Columns>
      <Settings ShowGroupPanel="True" ShowFooter="True"/>
    <Styles CssFilePath="~/App_Themes/BlackGlass/{0}/styles.css" CssPostfix="BlackGlass">
    <AlternatingRow Enabled="True"/>
        <Header ImageSpacing="5px" SortingImageSpacing="5px">
        </Header>        
     </Styles>
       <SettingsEditing PopupEditFormModal="True" Mode="EditForm"  />  
         <Images ImageFolder="~/App_Themes/BlackGlass/{0}/">            
         </Images>       
      <SettingsPager PageSize="20">
      </SettingsPager>
</dxwgv:ASPxGridView>
 <data:TinTucDataSource EnableDeepLoad="true" ID="TinTucDataSource" SelectMethod="GetAll" runat="server"
	 InsertMethod="Insert" UpdateMethod="Update"
	 > 	 
	 <DeepLoadProperties Method="IncludeChildren" Recursive="false">
	 <Types>
	 <data:TinTucProperty Name="TinTucDanhMuc" />
	 </Types>
	 </DeepLoadProperties>
     </data:TinTucDataSource>  
 <asp:Label ID="lblCatIDSelected" runat="server" Text='' Visible="false"></asp:Label>
 <div align="left" style="float:left;width:705px;padding-left:2px;margin-top:2px;">
        <asp:Button ID="Button1" CssClass="button" runat="server" Text="Create SiteMap" OnClick="Button1_Click" /><span style="color:Red">* Important</span>
    </div>  
                
            </div>
        </td>
        <td class="tdBCMiddleRight"><div class="tdBCMiddleRight" style="visibility:hidden"></div></td>
        </tr>
        <tr>
        <td class="tdBCBottomLeft"></td>
        <td class="tdBCBottomCenter"></td>
        <td class="tdBCBottomRight"></td>
        </tr>
    </table>

  </div>
  </div>
  </asp:Panel> 
</asp:Content>